import request from "@/utils/request";
import type {AreaParamsType} from "@/types/address";

export default {
    /*获取轮播图*/
    getBannerList: (slug:string) => request({
        url: '/api/slideshow.slideshow/detail',
        method: 'GET',
        params: {
            slug
        }
    }),
    /*获取验证码*/
    getCaptchaData: (id: string) => request({
        url: '/api/common/clickCaptcha',
        method: 'GET',
        params: {
            id
        }
    }),
    /*校验验证码*/
    checkClickCaptcha: (id: string, info: string,unset:boolean) => request({
        url: '/api/common/checkClickCaptcha',
        method: 'POST',
        data: {
            id,
            info,
            unset
        },
        custom: {
            showError: false
        }
    }),
    /* 获取省市区信息 */
    getAreaApi: (params:AreaParamsType = {}) => request({
        url: '/api/ajax/area',
        method: 'GET',
        params: {
            ...params
        },
        custom: {
            showError: false,
            showLoading: false
        }
    }),
    /*上传图片*/
    uploadApi: (file:any) => request({
        url: '/api/ajax/upload',
        method: 'UPLOAD',
        name: 'file',
        filePath: file,
        custom: {
            showLoading: true,
            loadingMsg: '上传中',
            auth: true,
            showSuccess: true,
        }
    }),
    /* 发送短信验证码 */
    smsSendApi:(data:any)=>request({
        url: '/api/sms/send',
        method: 'POST',
        data,
        custom: {
            showSuccess: true,
        }
    })
}
